import React, { useState } from 'react'

export default function GuideEditor({ selectedSlot, onAddGuide }) {
  const [startPoint, setStartPoint] = useState(null)

  const handleStartGuide = () => {
    if (selectedSlot) {
      setStartPoint({
        x: selectedSlot.x + 30,
        y: selectedSlot.y + 15,
      })
    }
  }

  const handleCompleteGuide = (endSlot) => {
    if (startPoint && endSlot) {
      onAddGuide({
        start: startPoint,
        end: {
          x: endSlot.x + 30,
          y: endSlot.y + 15,
        },
      })
      setStartPoint(null)
    }
  }

  return (
    <div className="editor-panel">
      <button onClick={handleStartGuide}>开始绘制引导线</button>
      {startPoint && <div>请点击目标车位完成引导线</div>}
    </div>
  )
}
